package com.power.ding.api;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;

import com.plf.common.domain.ResponseDTO;
import com.power.ding.exception.DingException;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 赣政通系统对接
 *
 * @author wangn
 * @see https://openplatform-portal.dg-work.cn/portal/#/helpdoc?apiType=serverapi&docKey=2674862
 */
public interface ISystemFeign {
    /**
     * 强行更新应用access_token，7200秒有效
     *
     * @return access_token
     */
    @PostMapping("/ding/app/reloadAccessToken")
    ResponseDTO reloadAccessToken() throws DingException;

    /**
     * 获取应用access_token，如有缓存则取缓存的
     *
     * @return access_token
     */
    @PostMapping("/ding/app/getAccessToken")
    ResponseDTO getAccessToken() throws DingException;

    /**
     * 根据auth_code获取当前用户信息
     *
     * @param auth_code
     * @return 当前登录用户基本信息
     */
    @PostMapping("/ding/app/getAppUser")
    ResponseDTO getAppUser(@RequestParam String auth_code) throws DingException;

    /**
     * 根据authCode获取登录token
     *
     * @param auth_code
     * @return 当前登录token信息
     */
    @PostMapping("/ding/app/getAppToken")
    ResponseDTO getAppToken(@RequestParam String auth_code);

    /**
     * 获取JSAPI鉴权token
     *
     * @return
     */
    @PostMapping("/ding/app/getJsapiToken")
    ResponseDTO getJsapiToken();

    /**
     * 获取服务器标准时间
     *
     * @return
     * @throws DingException
     */
    @PostMapping("/ding/app/getTime")
    ResponseDTO getTime() throws DingException;

    /**
     * 返回构造的用户信息授权页面地址
     * employeeCode: 通过 /ding/app/getAppUser 返回的用户信息中的 employeeCode，例如 GE__240116165938Prbq9KXch5suH37i2Ha
     * redirect: 授权后跳转地址，例如 http://10.2.3.4/xxx , 则授权成功后，会跳转到 http://10.2.3.4/xxx?code=201019212931i3p5ClVLHCo0t8YNJih
     *
     * @return
     * @throws DingException
     */
    @PostMapping("/ding/open/authorize")
    ResponseDTO getOpenAuthorizeUrl(String employeeCode, String redirect) throws DingException;

    /**
     * 获取授权的用户信息
     *
     * @param code: 通过 /ding/open/authorize 后 redirect 地址的code
     * @return
     * @throws DingException
     */
    @PostMapping("/ding/open/getOpenUser")
    ResponseDTO getOpenUser(String code) throws DingException;

    /**
     * 发送消息
     *
     * @param id
     * @return
     * @throws DingException
     */
    @PostMapping("/ding/message/send")
    ResponseDTO sendMessage(@RequestParam String id) throws DingException;

    /**
     * 获取消息
     *
     * @param id
     * @return
     * @throws DingException
     */
    @RequestMapping("/ding/message/view")
    ResponseDTO getMessage(@RequestParam String id) throws DingException;

    /**
     * 发送待办
     *
     * @param id
     * @return
     * @throws DingException
     */
    @PostMapping("/ding/todo/send")
    ResponseDTO sendTodo(@RequestParam String id) throws DingException;

    /**
     * 获取待办详情
     * @param id
     * @return
     * @throws DingException
     */
    @PostMapping("/ding/todo/view")
    ResponseDTO getTodo(@RequestParam String id) throws DingException;

    /**
     * 完成待办
     *
     * @param id
     * @return
     * @throws DingException
     */
    @PostMapping("/ding/todo/finishTodo")
    ResponseDTO finishTodo(@RequestParam String id) throws DingException;

    /**
     * 删除待办
     * @param id
     * @return
     * @throws DingException
     */
    @PostMapping("/ding/todo/del")
    ResponseDTO delTodo(@RequestParam String id) throws DingException;
}
